//
//  DesEncrypt.h
//  Fakid
//
//  Created by Peter Yuen on 6/30/14.
//
//

#import <Foundation/Foundation.h>
#import<CommonCrypto/CommonCryptor.h>


//预定义函数结构体，方便外部调用，具体在m文件实现，防止注入、hook攻击
typedef struct _desEncrypt{
//    const char *(*encryptWithKeyAndType)(char *text,CCOperation operate,char *key);
    const char* (*encryptText)(const char* text,const char *key,const char *iv);
    const char* (*decryptText)(const char* text,const char *key,const char *iv);
}_desEncrypt;


@interface DesEncrypt : NSObject
{

}

+(_desEncrypt *)sharedDesEncrypt;

static const char* encryptWithKeyAndType(const char *text,CCOperation encryptOperation,const char *key,const char *initIv);

+ (NSString *)encryptText:(NSString *)text;
+ (NSString *)decryptText:(NSString *)text;

+ (NSString *)encryptText:(NSString *)text key:(NSString*)key iv:(NSString *)iv;

+ (NSString *)decryptText:(NSString *)text key:(NSString*)key iv:(NSString *)iv;

+ (NSString *)desDealText:(NSString *)text key:(NSString*)key iv:(NSString *)iv operation:(CCOperation)encryptOperation;
+ (NSData *)desDealData:(NSData *)data key:(NSString*)key iv:(NSString *)iv operation:(CCOperation)encryptOperation;

@end
